//
//  RootView.m
//  UI6_UIScrollView_UIPageControl下午练习
//
//  Created by dllo on 15/11/13.
//  Copyright (c) 2015年 dllo. All rights reserved.
//

#import "RootView.h"

@implementation RootView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self createSubviews];
    }
    return self;
}

- (void)createSubviews
{
    self.backgroundColor = [UIColor whiteColor];
    
    UIScrollView *scrollV = [[UIScrollView alloc] initWithFrame:self.frame];
    
    scrollV.contentSize = CGSizeMake(0, self.frame.size.height * 19);
    scrollV.pagingEnabled = YES;
    scrollV.bounces = NO;
    scrollV.showsVerticalScrollIndicator = YES;
    
    for (NSInteger i = 0; i < 20; i++) {
        NSString *fileName = [NSString stringWithFormat:@"image%ld.jpg", i + 1];
        UIImageView *imageV = [[UIImageView alloc] initWithFrame:CGRectMake(0, i * self.frame.size.height, self.frame.size.width, self.frame.size.height)];
        imageV.image = [UIImage imageNamed:fileName];
        [scrollV addSubview:imageV];
        [imageV release];
        
    }
    
    
    
    
    [self addSubview:scrollV];
    [scrollV release];
    
    
    
}




@end
